home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / pnl010.zip / MDP1.PAS < prev    next >
Pascal/Delphi Source File  |  1992-03-01  |  1KB  |  36 lines

  1. program mdp1;
  2.  
  3. {Program to accompany article in issue #10 of the Pascal NewsLetter.        }
  4. {Author: Mitch Davis, (3:634/384.6) +61-3-890-2062.                         }
  5.  
  6. {Reads up to 100 lines from a file specified on the command line.  Note this}
  7. {program works by actually reading in the data from the file into a fixed-  }
  8. {size array.                                                                }
  9.  
  10. const MaxLines = 100;
  11.  
  12. var line:array [1..MaxLines] of string; { This takes 25600 bytes }
  13.     LineCount,Loop:word;
  14.     f:text;
  15.  
  16. begin
  17.   writeln ('Reading...');
  18.   assign (f,paramstr (1));
  19.   reset (f);
  20.   LineCount := 0;
  21.   while not (eof (f) or (LineCount = MaxLines)) do begin
  22.     inc (LineCount);
  23.     readln (f,line [LineCount]);
  24.   end;
  25.   close (f);
  26.   writeln;
  27.  
  28.   writeln ('Forward:');
  29.   for loop := 1 to LineCount do writeln (loop:3,':',line [loop]);
  30.   writeln;
  31.  
  32.   writeln ('Backwards:');
  33.   for loop := LineCount downto 1 do writeln (loop:3,':',line [loop]);
  34.   writeln ('Done!');
  35. end.
  36.